package com.example.busshop.dao;

import com.example.busshop.common.dao.LogicDAO;
import com.example.busshop.entity.Order;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Set;

public interface OrderDao extends LogicDAO<Order,Long> {
    @Transactional
    @Modifying
    @Query(value = "update orders set status=1 where Id=?1",nativeQuery = true)
    int pay(Long Id);
    @Query(value = "select * from orders where customer_id=?1",nativeQuery = true)
    List<Order> listOrder(Long cid);
    @Query(value = "select * from orders where shop_id=?1",nativeQuery = true)
    Set<Order> listOrderBus(Long sid);
    @Transactional
    @Modifying
    @Query(value = "update orders set is_deleted=1 where Id=?1",nativeQuery = true)
    public int IsDeleted(Long Id);

}
